Package com.fish

Source Code of com.fish.FishFood

package com.fish;
import java.awt.Color;

import com.graphics.Camera;
import com.graphics.Oval;
import com.math.Quat;
import com.math.Vector;

public class FishFood extends Oval{
 
  private static final float VEL_CONST = 0.10f;
  private static final Vector dim = new Vector(5/20f,5/20f,20/20f);
 
  Vector v;
 
  public FishFood(Camera cam) {
    super(cam,dim,
      new Vector( Fish.rand.nextFloat()*2*World.fishtank.d.x - World.fishtank.d.x,
            Fish.rand.nextFloat()*World.fishtank.d.y,
            Fish.rand.nextFloat()*2*World.fishtank.d.z - World.fishtank.d.z),
      Quat.getRandomQuat(),Color.yellow);
    World.shapes.add(this);
    v = new Vector(0,Fish.rand.nextFloat()*VEL_CONST,0);
  }
 
  public void step(){
    p.setSub(v);
    if(!World.isInBox(World.fishtank.boxes[0],p)){
      World.shapes.remove(this);
      World.sim_shapes.remove(this);
    }
  }
}
TOP

Related Classes of com.fish.FishFood

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.